/*
 * Copyright 2022 The Open Islands Authors. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.openislands.oi.util;

import org.openislands.oi.constant.LogTraceType;
import org.openislands.oi.constant.LogType;
import org.openislands.oi.constant.ServiceName;

public class CustomerLoggerFactory {
	
	/**空数组*/
	private static final Object[] EMPTY_ARRAY = new Object[] {};
	
	/**
	 * 获取自定义日志对象
	 * 
	 * @return CustomerLogger对象
	 */
	public static CustomerLogger getLogger() {
		return getLogger(null, null, LogType.STATS, EMPTY_ARRAY);
	}
	
	/**
	 * 获取自定义日志对象
	 *
	 * @param logType     日志类型，若为NULL默认为LogType.STATS
	 * @param bizLogPaths 业务日志路径，主要用于动态设置任务日志路径，数组第一个值建议传jobId
	 * @return CustomerLogger对象
	 */
	public static CustomerLogger getLogger(LogType logType, Object...bizLogPaths) {
		return getLogger(null, null, logType, bizLogPaths);
	}

	public static CustomerLogger getLogger(LogTraceType logTraceType, LogType logType, Object...bizLogPaths) {
		return getLogger(null, logTraceType, logType, bizLogPaths);
	}

	/**
	 * 获取自定义日志对象
	 * 
	 * @param serviceName 服务名称，若为NULL默认为系统属性service-name
	 * @param logType     日志类型，若为NULL默认为LogType.STATS
	 * @param bizLogPaths 业务日志路径，主要用于动态设置任务日志路径，数组第一个值建议传jobId
	 * @return CustomerLogger对象
	 */
	public static CustomerLogger getLogger(ServiceName serviceName, LogTraceType logTraceType, LogType logType, Object...bizLogPaths) {
		return new CustomerLogger(serviceName, logTraceType, logType, bizLogPaths);
	}
}
